//案例
import { CASE, CLASSIFY } from './api';
import { request, METHOD } from '@/utils/request';
//添加案例
export async function addCaseApi(params) {
  return request(CASE + '/create', METHOD.POST, params);
}
//删除案例
export async function delCaseApi(params) {
  return request(CASE + '/delete/', METHOD.DELETE, params.id);
}
//修改案例
export async function editCaseApi(params) {
  return request(CASE + '/update/', METHOD.PUT, params);
}
//获取所有案例
export async function getCaseListApi(params) {
  return request(CASE + '/getAll', METHOD.GET, params);
}
//根据id查找案例
export async function getCaseByIdApi(params) {
  return request(CASE + '/getById', METHOD.GET, params);
}

/*分类 */
//添加
export async function addClassifyApi(params) {
  return request(CLASSIFY + '/create', METHOD.POST, params);
}
//修改案例
export async function editClassifyApi(params) {
  return request(CLASSIFY + '/update/', METHOD.PUT, params);
}
//删除案例
export async function delClassifyApi(params) {
  return request(CLASSIFY + '/delete/', METHOD.DELETE, params.id);
}
//获取所有分类
export async function getClassifyListApi(params) {
  return request(CLASSIFY + '/getAll', METHOD.GET, params);
}
//根据分类id查找案例
export async function getCaseByClassifyIdApi(params) {
  return request(CLASSIFY + '/getById', METHOD.GET, params);
}

export default {
  addCaseApi,
  editCaseApi,
  delCaseApi,
  getCaseListApi,
  getCaseByIdApi,
  addClassifyApi,
  editClassifyApi,
  delClassifyApi,
  getClassifyListApi,
  getCaseByClassifyIdApi,
};
